﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using G.WeiBo.WebAPI.Domain;
using G.Controls;

namespace G.WeiBo.LoacalControls
{
    public class UserInfoControl : Control
    {
        public static readonly DependencyProperty UserInfoProperty = DependencyProperty.Register("UserInfo", typeof(UserInfo), typeof(UserInfoControl), null);
        public UserInfo UserInfo
        {
            get
            {
                return (UserInfo)this.GetValue(UserInfoProperty);
            }
            set
            {
                this.SetValue(UserInfoProperty, value);
            }
        }
        public UserInfoControl()
        {
            this.DefaultStyleKey = typeof(UserInfoControl);
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            TextButton btnNickName = this.GetTemplateChild("btnNickName") as TextButton;
            btnNickName.Click += (s, e) =>
            {
                G.Navigate.NavigationService.Navigate("/View/UserInfoPage.xaml", this.UserInfo);
            };

            ImageButton headImg = this.GetTemplateChild("headImg") as ImageButton;
            headImg.Click += (s, e) =>
            {
                G.Navigate.NavigationService.Navigate("/View/UserInfoPage.xaml", this.UserInfo);
            };
        }
    }
}
